package com.leng.controller;


import com.leng.entity.Department;
import com.leng.response.Result;
import com.leng.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author leng
 * @since 2022-08-21
 */
@RestController
@RequestMapping("/department")
public class DepartmentController {
    @Autowired
    private DepartmentService service;

    @GetMapping("/getDepartmentList")
    public Result getDepartmentNameAndCount(){
        List<Department> departmentList = service.getDepartmentNameAndCount();
        return Result.ok().data("departmentList",departmentList);
    }
}

